package com.moshang.blog.controller.back.system;

import java.util.Arrays;
import java.util.Map;

import com.moshang.blog.entity.SysRoleMenu;
import com.moshang.blog.core.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.moshang.blog.service.SysRoleMenuService;



/**
 * 
 *
 * @author moshang
 * @email 597575122@qq.com
 * @date 2018-09-21 14:45:09
 */
@RestController
@RequestMapping("blog/sysroleresources")
public class SysRoleResourcesController {
    @Autowired
    private SysRoleMenuService sysRoleMenuService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("blog:sysroleresources:list")
    public R list(@RequestParam Map<String, Object> params){


        return null;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("blog:sysroleresources:info")
    public R info(@PathVariable("id") Integer id){
			SysRoleMenu sysRoleResources = sysRoleMenuService.getById(id);

        return R.ok().put("sysRoleResources", sysRoleResources);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("blog:sysroleresources:save")
    public R save(@RequestBody SysRoleMenu sysRoleResources){
			sysRoleMenuService.save(sysRoleResources);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("blog:sysroleresources:update")
    public R update(@RequestBody SysRoleMenu sysRoleResources){
			sysRoleMenuService.updateById(sysRoleResources);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("blog:sysroleresources:delete")
    public R delete(@RequestBody Integer[] ids){
			sysRoleMenuService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
